<template>
	<view class="mainbgc">
		<view class="mainpadding">
			<view class="mainpadding radius">
				<view class="flexbetween margin_top4 line" v-for="item in list.data" :key="item.id"
					@click="knowledge(item)">
					<view class="flexleft">
						<view class="dou"></view>
						<view class="grey_zi">{{item.question}}</view>
					</view>
					<view class="margin_left4 fan"></view>
				</view>
				<view class="zwtimg flexcenter" v-if="!list.data.length">
					<image src="https://qnwenbo.yuntaiqi.com/uploads/20230527/1d30ad56c2b2a57fdf222904874e20e4.png" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				headline_id: "",
				type: 1,
				page: 1,
				pagesize: 10,
				list: {
					data: []
				},
				name: ""
			}
		},
		onLoad(options) {
			this.headline_id = options.id
			this.type = options.type
			this.name = options.name
			uni.setNavigationBarTitle({
				title: this.name
			})
			this.init()
		},
		methods: {
			init(isPage, page) {
				let _this = this;
				httpRequest.request('/api/quizz/lists', 'POST', {
					// page: page || 1,
					// pagesize: this.pagesize,
					headline_id: this.headline_id,
					type: this.type
				}).then(res => {
					if (res.code == 1) {
						// let resList = res.data;
						// let dataList = _this.list;
						// if (isPage == true) {
						// 	_this.list.data = dataList.data.concat(resList.data);
						// } else {
						// 	_this.list = resList
						// 	_this.list.data = resList.data;
						// }
						_this.list.data = res.data
						// if (_this.list.data.length == 0) {
						// 	httpRequest.toast("该章节下还没有题目呦！");
						// 	setTimeout(() => {
						// 		uni.navigateBack(1)
						// 	}, 1000)
						// 	return false;
						// }
					} else {
						httpRequest.toast(res.msg);
					}
				})
			},
			// onReachBottom() {
			// 	let _this = this;
			// 	let list = _this.list;
			// 	let page = _this.page;
			// 	if (list.last_page <= page) {
			// 		return false;
			// 	}
			// 	page++;
			// 	_this.page = page;
			// 	_this.init(true, page);
			// },
			knowledge(item) {
				uni.navigateTo({
					url: "/pages/homepage/jiaoyuyjdx?id=" + item.id + "&headline_id=" + this.headline_id +
						"&type=" + this.type + "&name=" + this.name
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.line {
		border-bottom: 1rpx solid RGBA(236, 236, 236, 1);
		padding-bottom: 40rpx;
	}

	.box {
		box-shadow: 0rpx 0rpx 15rpx 0rpx rgba(51, 51, 51, 0.0500);
	}

	.mainbgc {
		overflow: hidden;
	}

	.dou {
		width: 9rpx;
		height: 9rpx;
		background: #666666;
		opacity: 1;
		border-radius: 50%;
		margin-right: 24rpx;
	}
</style>